template(name="cardAttachmentsPopup")
  if $gt uploads.length 0
    .attachment-upload {{_ 'uploading'}}
      table
        tr
          th.upload-file-name-descr {{_ 'name'}}
          th.upload-progress-descr {{_ 'progress'}}
          th.upload-remaining-descr {{_ 'remaining_time'}}
          th.upload-speed-descr {{_ 'speed'}}
        each upload in uploads
          tr
            td.upload-file-name-value {{upload.file.name}}
            td.upload-progress-value {{upload.progress.get}}%
            td.upload-remaining-value {{getEstimateTime upload}}
            td.upload-speed-value {{getEstimateSpeed upload}}
  else
    ul.pop-over-list
      li
        input.js-attach-file.hide(type="file" name="file" multiple)
        a.js-computer-upload {{_ 'computer'}}
      li
        a.js-upload-clipboard-image {{_ 'clipboard'}}

template(name="previewClipboardImagePopup")
  p <kbd>Ctrl</kbd>+<kbd>V</kbd> {{_ "paste-or-dragdrop"}}
  img.preview-clipboard-image()
  button.primary.js-upload-pasted-image {{_ 'upload'}}

template(name="attachmentDeletePopup")
  p {{_ "attachment-delete-pop"}}
  button.js-confirm.negate.full(type="submit") {{_ 'delete'}}

template(name="attachmentsGalery")
  .attachments-galery
    if currentUser.isBoardMember
      unless currentUser.isCommentOnly
        unless currentUser.isWorker
          //li.attachment-item.add-attachment
          a.js-add-attachment(title="{{_ 'add-attachment' }}")
            i.fa.fa-plus
    each attachments
      .attachment-item
        a.attachment-thumbnail.swipebox(href="{{link}}" title="{{sanitize name}}")
          if link
            if isImage
              img.attachment-thumbnail-img(src="{{link}}" title="{{sanitize name}}")
            else if($eq extension 'mp3')
              video(width="100%" height="100%" title="{{sanitize name}}" controls="true")
                source(src="{{link}}" type="audio/mpeg")
            else if($eq extension 'ogg')
              video(width="100%" height="100%" title="{{sanitize name}}" controls="true")
                source(src="{{link}}" type="video/ogg")
            else if($eq extension 'webm')
              video(width="100%" height="100%" title="{{sanitize name}}" controls="true")
                source(src="{{link}}" type="video/webm")
            else if($eq extension 'mp4')
              video(width="100%" height="100%" title="{{sanitize name}}" controls="true")
                source(src="{{link}}" type="video/mp4")
            else
              span.attachment-thumbnail-ext= extension
        p.attachment-details
          = name
          span.file-size ({{fileSize size}})
          span.attachment-details-actions
            a.js-download(href="{{link}}?download=true", download="{{name}}")
              i.fa.fa-download
              | {{_ 'download'}}
            if currentUser.isBoardMember
              unless currentUser.isCommentOnly
                unless currentUser.isWorker
                  a.fa.fa-navicon.attachment-details-menu.js-open-attachment-menu(title="{{_ 'attachmentActionsPopup-title'}}")

template(name="attachmentActionsPopup")
  ul.pop-over-list
    li
      if isImage
        a(class="{{#if isCover}}js-remove-cover{{else}}js-add-cover{{/if}}")
          i.fa.fa-book
          i.fa.fa-picture-o
          if isCover
            | {{_ 'remove-cover'}}
          else
            | {{_ 'add-cover'}}
      if currentUser.isBoardAdmin
        if isImage
          a(class="{{#if isBackgroundImage}}js-remove-background-image{{else}}js-add-background-image{{/if}}")
            i.fa.fa-picture-o
            if isBackgroundImage
              | {{_ 'remove-background-image'}}
            else
              | {{_ 'add-background-image'}}
        a.js-rename
          i.fa.fa-pencil-square-o
          | {{_ 'rename'}}
        a.js-confirm-delete
          i.fa.fa-close
          | {{_ 'delete'}}
        p.attachment-storage
          | {{versions.original.storage}}

        if $neq versions.original.storage "fs"
          a.js-move-storage-fs
            i.fa.fa-arrow-right
            | {{_ 'attachment-move-storage-fs'}}

        if $neq versions.original.storage "gridfs"
          if versions.original.storage
            a.js-move-storage-gridfs
              i.fa.fa-arrow-right
              | {{_ 'attachment-move-storage-gridfs'}}

        if $neq versions.original.storage "s3"
          if versions.original.storage
            a.js-move-storage-s3
              i.fa.fa-arrow-right
              | {{_ 'attachment-move-storage-s3'}}

template(name="attachmentRenamePopup")
  input.js-edit-attachment-name(type='text' autofocus value="{{getNameWithoutExtension}}" dir="auto")
  .edit-controls.clearfix
    button.primary.confirm.js-submit-edit-attachment-name(type="submit") {{_ 'save'}}
